using System;
using System.Linq;
using Pay.DTO;
using System.Collections.Generic;
using Pay.Data;
using Pay.Service.Cache;
using Pay.Core;
using Pay.IService;
using Pay.TO;
using System.Linq.Expressions;

namespace Pay.Service {
    public class PostFeeService : ServiceBase, IPostFeeService, IDisposable {
        private IUnitOfWork _iUnitOfWork;

        public PostFeeService(IUnitOfWork iUnitOfWork) : base(iUnitOfWork) {
            _iUnitOfWork = iUnitOfWork;
        }

        public post_fee_dto GetPostById(long id) {
            if (id == 0)
                return null;
            return context.PostFees.Where(c => c.Id == id).FromCacheFirstOrDefault<PostFee, post_fee_dto>("PostFee");
        }

        public post_fee_dto GetPostByName(string name) {
            if (name == "") {
                return null;
            } else {
                return context.PostFees.Where(x => x.Province.Contains(name)).FromCacheFirstOrDefault<PostFee, post_fee_dto>("PostFee");
            }
        }


    }
}
